<?php

/**
* SPECIAL OFFERS
* Copyright (c) 2012 
* Author: Dmitriy Tovkach (ragvalod@gmail.com)
* @license		GNU/GPL
**/

defined('_JEXEC') or die;

class SpecialController extends JController
{
	
	public function display($cachable = false, $urlparams = false)
	{
		require_once JPATH_COMPONENT.'/helpers/special.php';

		

		$view		= JRequest::getCmd('view', 'special');
		$layout 	= JRequest::getCmd('layout', 'default');
		$id			= JRequest::getInt('id');
		
        //if ($view == "slides") { 	  
		//   $this->setRedirect(JRoute::_('index.php?option=com_locations&view=locations', false));
		//   return false;
		//}
		//exit;
		// Check for edit form.
		if ($view == 'promotions') {		
			$this->setRedirect(JRoute::_('index.php?option=com_special&view=special', false));
			return false;
		}
		if ($view == 'slide' && $layout == 'edit' && !$this->checkEditId('com_slideshow.edit.slide', $id)) {
			// Somehow the person just went to the form - we don't allow that.
			
			$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
			$this->setMessage($this->getError(), 'error');
			$this->setRedirect(JRoute::_('index.php?option=com_special&view=special', false));

			return false;
		}

		parent::display();

		return $this;
	}
}
